package lolxxs.chenyanting.config;


import lolxxs.chenyanting.interceptor.CacheInterceptor;
import lolxxs.chenyanting.interceptor.JwtInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

//拦截器配置
@Configuration
public class InterceptorConfig extends WebMvcConfigurationSupport{

    @Autowired
    private JwtInterceptor jwtInterceptor;

    @Autowired
    private CacheInterceptor cacheInterceptor;

    protected void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(jwtInterceptor)
//                .addPathPatterns("/**")
////                .excludePathPatterns("/user/**")
//                .excludePathPatterns("/user/login")
//                .excludePathPatterns("/user/remotelogin")
//                .excludePathPatterns("/user/add");//配置注册不拦截 从类的上面路径开始

        // 添加需要添加缓存的路径
//        registry.addInterceptor(cacheInterceptor)
//                .addPathPatterns("/user/**");
//                .excludePathPatterns("/user/**")
//                .excludePathPatterns("/user/login")
//                .excludePathPatterns("/user/add");
    }
}
